The features for a domain are more a property of the domain than the
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 28 Apr 2006 13:10:59 +0000 (14:10 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 28 Apr 2006 13:10:59 +0000 (14:10 +0100)
image.  Move them into the domain info so that the image is just the
pieces needed for booting (eg, kernel + initrd + args)

Signed-off-by: Jeremy Katz <katzj@redhat.com>
tools/python/xen/xend/XendDomainInfo.py
tools/python/xen/xend/image.py
tools/python/xen/xm/create.py

index 59283e97377d4b58fc6a7efcf6eca9f0ef19356d..1030637012486fb976759f7f967c695968492adc 100644 (file)
@@ -132,6 +132,7 @@ ROUNDTRIPPING_CONFIG_ENTRIES = [
     ('memory',     int),
     ('maxmem',     int),
     ('bootloader', str),
+    ('features', str),
     ]
 
 ROUNDTRIPPING_CONFIG_ENTRIES += VM_CONFIG_PARAMS
@@ -549,6 +550,7 @@ class XendDomainInfo:
             defaultInfo('on_poweroff',  lambda: "destroy")
             defaultInfo('on_reboot',    lambda: "restart")
             defaultInfo('on_crash',     lambda: "restart")
+            defaultInfo('features',     lambda: "")
             defaultInfo('cpu',          lambda: None)
             defaultInfo('cpus',         lambda: [])
             defaultInfo('cpu_weight',   lambda: 1.0)
@@ -775,6 +777,9 @@ class XendDomainInfo:
         """For use only by image.py and XendCheckpoint.py"""
         return self.console_port
 
+    def getFeatures(self):
+        """For use only by image.py."""
+        return self.info['features']
 
     def getVCpuCount(self):
         return self.info['vcpus']
index f9b061a4ec0e0aea41a072847093052b5e5761dc..43ed39993c07cd3cd5edd09b31b8e14dd88d9c0d 100644 (file)
@@ -68,7 +68,6 @@ class ImageHandler:
         self.kernel = None
         self.ramdisk = None
         self.cmdline = None
-        self.features = None
 
         self.configure(imageConfig, deviceConfig)
 
@@ -90,7 +89,6 @@ class ImageHandler:
         if args:
             self.cmdline += " " + args
         self.ramdisk = get_cfg("ramdisk", '')
-        self.features = get_cfg("features", '')
         
         self.vm.storeVm(("image/ostype", self.ostype),
                         ("image/kernel", self.kernel),
@@ -177,7 +175,7 @@ class LinuxImageHandler(ImageHandler):
         log.debug("cmdline        = %s", self.cmdline)
         log.debug("ramdisk        = %s", self.ramdisk)
         log.debug("vcpus          = %d", self.vm.getVCpuCount())
-        log.debug("features       = %s", self.features)
+        log.debug("features       = %s", self.vm.getFeatures())
 
         return xc.linux_build(dom            = self.vm.getDomid(),
                               image          = self.kernel,
@@ -185,7 +183,7 @@ class LinuxImageHandler(ImageHandler):
                               console_evtchn = console_evtchn,
                               cmdline        = self.cmdline,
                               ramdisk        = self.ramdisk,
-                              features       = self.features)
+                              features       = self.vm.getFeatures())
 
 class HVMImageHandler(ImageHandler):
 
index 37589f855d135d2216d14c3965e11faa0bc49d04..1c52f20a6a19e3294e49ead88cad3c614f5f0574 100644 (file)
@@ -456,8 +456,6 @@ def configure_image(vals):
         config_image.append(['root', cmdline_root])
     if vals.extra:
         config_image.append(['args', vals.extra])
-    if vals.features:
-        config_image.append(['features', vals.features])
 
     if vals.builder == 'hvm':
         configure_hvm(config_image, vals)
@@ -638,7 +636,7 @@ def make_config(vals):
                 config.append([n, v])
 
     map(add_conf, ['name', 'memory', 'maxmem', 'restart', 'on_poweroff',
-                   'on_reboot', 'on_crash', 'vcpus'])
+                   'on_reboot', 'on_crash', 'vcpus', 'features'])
 
     if vals.uuid is not None:
         config.append(['uuid', vals.uuid])